
$(function() {
	$("li:has(ul)").click(function(event) {//为包含ul元素的li定义点击事件
		if(event.target == this) {
			if($(this).children().is(":hidden")) {
				$(this).css("background", "url(images/32d2s2_13.jpg) left 10px no-repeat");
				$(".first").remove("list-style-image", "")
			} else {
				$(this).css("background", "url(images/32d2s2_07.jpg) left 10px no-repeat");
			}
			$(this).children().toggle(500);
		}
	});
	$("li:not(:has(ul))").css("list-style","none");
});

onload = function(){
	var lis = document.getElementsByTagName("tr");
	var newlist = [];
	for(var i=0; i<lis.length; i++){
		if( lis[i].nodeType == 1){
			newlist.push(lis[i]);
		}
	}
	for(var i in newlist){
		if(i%2!=0){
			newlist[i].style.background = "blue";
		}
	}
}

$(function(){
	$(".span:nth(0)").css({"background":"blue"});
	$(".span:nth(0)").click(function(){
		$(".ul1").show().siblings().hide();
		console.log("a");
		$(".span:nth(0)").css({"background":"blue"}).siblings().css({"background":"red"});
	})
	$(".span:nth(1)").click(function(){
		$(".ul2").show().siblings().hide();
		$(".span:nth(1)").css({"background":"blue"}).siblings().css({"background":"red"});
	})
	$(".span:nth(2)").click(function(){
		$(".ul3").show().siblings().hide();
		$(".span:nth(2)").css({"background":"blue"}).siblings().css({"background":"red"});
	})
})


onload = function(){
	document.onclick = function(){
		var tbody = document.getElementById("tbody")
		var tr1 = tbody.children[1].cloneNode(true);
		var tr2 = tbody.children[2].cloneNode(true);
		console.log(tr1);
		console.log(tr2);
		tr2.children[0].innerHTML = "<img src=\"images/32d2s2_34.jpg\"/>";
		tr2.children[1].innerHTML = "你好";
		tr2.children[2].innerHTML = "￥240";
		tr2.children[3].innerHTML = "2015-09-11";
		tr2.children[4].innerHTML = "已支付";
		tr2.children[5].innerHTML = "去付款<br/>查看详情";
		tr1.children[0].innerHTML = "<span>|</span>订单编号:<span>20150910000174</span>&nbsp;&nbsp;百联E城";
		tbody.appendChild(tr1);
		tbody.appendChild(tr2);
	}
}
